<template>
	<!-- <view :class="isColorOff?'ColorOff':'ColorOn'"> -->

	<view class="head displayFlex" :style="{height:winInfo.height-25+'px',paddingTop:winInfo.top-15+'px'}">
		<image @tap="returnTap" style="width: 34rpx" src="/static/return.png" mode="widthFix">
		</image>
		<text>{{title}}</text>
	</view>
	
	
	<!-- </view> -->
</template>

<script>
	export default {
		data() {
			return {
				winInfo: {
					height: 34, //header高度
					top: 26, //标题图标距离顶部距离
					scrollH: 0 //滚动总高度
				},
			}
		},
		props: {
			title: { // 标题
				type: String,
				default: ''
			},
			isColorOff: { // 背景颜色
				type: Boolean,
				default: true
			},
		},
		methods: {
			returnTap() {
				uni.navigateBack()
				// uni.reLaunch()

			},
		},
		mounted() {
			let obj = {};
			// #ifdef MP-WEIXIN
			obj = wx.getMenuButtonBoundingClientRect();
			// #endif
			// #ifdef MP-BAIDU
			obj = swan.getMenuButtonBoundingClientRect();
			// #endif
			// #ifdef MP-ALIPAY
			my.hideAddToDesktopMenu();
			// #endif
			setTimeout(() => {
				uni.getSystemInfo({
					success: (res) => {
						this.winInfo = res;
						this.winInfo.width = obj.left || res.windowWidth;
						this.winInfo.height = obj.top ? obj.top + obj.height + 8 : res
							.statusBarHeight + 44;
						this.winInfo.top = obj.top ? obj.top + (obj.height - 32) / 2 : res
							.statusBarHeight + 6;
						this.winInfo.scrollH = res.windowWidth;
					}
				});
			}, 0);
		},
	}
</script>

<style lang="scss">
	.ColorOff {
		background-color: #000;
	}

	.ColorOn {
		background-color: #1F9A4F;
	}

	.head {
		position: fixed;
		left: 0;
		width: 100%;
		top: 0;
		z-index: 100;
		// background-color: #1F9A4F;
		// background-color: #fff;

		image {
			margin: 0 0rpx 0 30rpx;
		}

		text {
			font-weight: 800;
			font-size: 34rpx;
			color: #333333;
		}
	}
</style>